package com.yuanyefu.helloworld;

import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;

import java.util.List;

/**
 * Created by 339814 on 2017/9/15.
 */
public class SpringStartup {
    public static void main(String[] args) throws InterruptedException {
       /* ApplicationContext context = new ClassPathXmlApplicationContext(("/spring/beans.xml"));
        HelloWorld hello = (HelloWorld) context.getBean("hello");
        System.out.println(hello.say());*/
    /*    ApplicationContext context = new ClassPathXmlApplicationContext(("/spring/beans.xml"));
        ExampleBean bean = (ExampleBean) context.getBean("exampleBean");
       List list= bean.getList();
       System.out.print( list.size());*/
        /*ApplicationContext context = new ClassPathXmlApplicationContext(("/spring/beans.xml"));
        PropBean bean = (PropBean) context.getBean("propBean");
        System.getProperties();*/
    /*    new FileSystemXmlApplicationContext("classpath:spring/config.xml");*/
        //ApplicationContext context = new ClassPathXmlApplicationContext(("/spring/beans.xml"));
        XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("/spring/beans.xml"));
        //factory.addBeanPostProcessor(new MyBeanPostProcessor());

        BasicBean basicBean = (BasicBean) factory.getBean("basicBean");
        System.out.println(basicBean.getTitle());
      /*  System.out.println(context.getBean("currentTime"));
        Thread.sleep(10000);
        System.out.println(context.getBean("currentTime"));*/
     /*   System.out.println(context.getBean("&pi"));*/
    }
}
